var getInfo = window.location.search.slice(window.location.search.lastIndexOf("?") + 1);
var id = getInfo;
Ajax({
    url: 'http://localhost:3000/playlist/detail',
    params: {
        id: id,
    },
    type: 'get',
}).then(function (res) {
    console.log(res);
    const jFlag = document.querySelector('.jFlag');
    const mfo = document.querySelector('.m-info');
    const ndesc = document.querySelector('.n-albdesc');
    const nsong = document.querySelector('.n-songtb');
  
    let mInfo = template('mInfo', {
        data: res.playlist,
    })
    mfo.innerHTML = mInfo;
    let nAlbdesc = template('nAlbdesc', {
        data: res.playlist,
    })
    ndesc.innerHTML = nAlbdesc;
    let nSongtb = template('nSongtb', {
        data: res.playlist,
    })
    nsong.innerHTML = nSongtb;
      // 注册一个过滤器 通过处理时间戳 转为日期格式
      template.defaults.imports.dateTimeFormat = function (dateTime, format) {
        const se = Math.floor(dateTime / 1000);
        const minute = Math.floor(se / 60);
        const sec = (se % 60);
        let second;
        let formatMiu;
        formatMiu = minute < 10 ? '0' + minute : minute;
        second = sec < 10 ? '0' + sec : sec;
        return formatMiu + ":" + second
    }
    let tableTpl = template('tableTpl', {
        data: res.playlist.tracks,
    })
    jFlag.innerHTML = tableTpl;
})